package wage;

import java.text.DecimalFormat;

/**
 * Created by yangluhua on 2017/1/10 0010.
 * incomeGD  每月固定工资
 * hour15  1.5倍加班时间
 * hour2   2倍加班时间
 * hour3  3倍加班时间
 * insure  五险
 * other  其它扣钱的地方，比如迟到
 */
public class Wage {
    public static void main(String[] args) {
        Wage.getIncome(9000,45,38,0,500,1590.38,0);
    }
    public static void getIncome(double incomeGD,double hour15,double hour2,double hour3,double eat,double insure,double other){
        double totalHour = 21.75 + (hour2*2+hour15*1.5+hour3*3)/8;
        double income = incomeGD/21.75*totalHour+eat;
        System.out.println("总收入："+income);
        double baseLine = 3500;//起征点
        double taxableIncome = income - insure - baseLine - other;//应收入-五险-起征点
        double R,Q;
        double A=taxableIncome;

        DecimalFormat df=new DecimalFormat("#.00");
        A=Double.parseDouble(df.format(A));
        if(A<=1500){R=0.03;Q=0;}
        else if(A>1500 && A<=4500){R=0.1;Q=105;}
        else if(A>4500 && A<=9000){R=0.2;Q=555;}
        else if(A>9000 && A<=35000){R=0.25;Q=1005;}
        else if(A>35000 && A<=55000){R=0.3;Q=2755;}
        else if(A>55000 && A<=80000){R=0.35;Q=5505;}
        else{R=0.45;Q=13505;}
        double tax=taxableIncome * R - Q;
        System.out.println("收取的所得税是："+df.format(tax));
        System.out.println("五险一金："+1590.38);
        double realIncome=income - insure - tax - other;
        System.out.println("到手收入："+df.format(realIncome));
    }
}
